#include <iostream>
#include <vector>

using namespace std;

// 2760. 最长奇偶子数组
// https://leetcode.cn/problems/longest-even-odd-subarray-with-threshold/description/

class Solution
{
public:
    int longestAlternatingSubarray(vector<int> &nums, int threshold)
    {
        int i = 0;
        int ans = 0;
        int n = nums.size();
        while (i < n)
        {
            if (nums[i] > threshold || nums[i] % 2 == 1)
            {
                i++;
                continue;
            }
            int left = i;
            i++;
            while (i < n && nums[i] <= threshold && nums[i] % 2 != nums[i - 1] % 2)
            {
                i++;
            }
            ans = max(ans, i - left);
        }
        return ans;
    }
};

int main()
{
    return 0;
}